package com.expressage.service.impl;

import com.expressage.dao.BoardDao;
import com.expressage.po.Board;
import com.expressage.service.BoardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.util.List;

/**
 * @author Gt
 * 公告业务逻辑实现类
 */
@Service("boardService")
public class BoardServiceImpl implements BoardService {

    @Autowired
    BoardDao boardDao;

    @Override
    public List<Board> findAll() {
        return boardDao.findAll();
    }

    @Override
    public boolean insert(Board board) {
        board.setDate(new Timestamp(System.currentTimeMillis()));//当前的时间
        return boardDao.insert(board)>0?true:false;
    }

    @Override
    public boolean delete(int[] arrays) {
        return boardDao.delete(arrays)>0?true:false;
    }

    @Override
    public boolean update(Board board) {
        return boardDao.update(board)>0?true:false;
    }

    @Override
    public Board findBybid(int bid) {
        return boardDao.findBybid(bid);
    }
}
